import unittest
from BeautifulReport import BeautifulReport
import time
from os.path import join
from config.config import CASE_PATH, REPORT_PATH#引入环境变量的值


#数据
test_dir=join(CASE_PATH, "po")
test_case='test_*.py'


discover=unittest.defaultTestLoader.discover(test_dir, pattern=test_case)

# runner = unittest.TextTestRunner()
# runner.run(discover)
#
# report_dir = r"E:\pycharm文件\unittest\log"
# if not os.path.exists(report_dir):
#     os.makedirs(report_dir)

BeautifulReport(discover).report(
    description=u'自动化测试报告',
    report_dir=f"{REPORT_PATH}",
    filename=time.strftime("%Y%m%d%H%M%S",time.localtime())+'.html')
